package com.lzxzjy.pojo;

public class BorrowInfo {
    private Integer bookId;               // 图书编号
    private String bookName;              // 书名
    private Integer readerId;       // 读者编号
    private String readerName;      // 读者姓名
    private String borrowedTime;   // 借书时间
    private String returnTime;    // 还书时间
    private Double arrears;      // 欠费

    // 构造函数
    public BorrowInfo() {
    }

    public BorrowInfo(Integer bookId, String bookName, Integer readerId, String readerName, String borrowedTime, String returnTime, Double arrears) {
        this.bookId = bookId;
        this.bookName = bookName;
        this.readerId = readerId;
        this.readerName = readerName;
        this.borrowedTime = borrowedTime;
        this.returnTime = returnTime;
        this.arrears = arrears;
    }

    // Getter 和 Setter 函数
    public Integer getBookId() {
        return bookId;
    }

    public void setBookId(Integer bookId) {
        this.bookId = bookId;
    }

    public String getBookName() {
        return bookName;
    }

    public void setBookName(String bookName) {
        this.bookName = bookName;
    }

    public Integer getReaderId() {
        return readerId;
    }

    public void setReaderId(Integer readerId) {
        this.readerId = readerId;
    }

    public String getReaderName() {
        return readerName;
    }

    public void setReaderName(String readerName) {
        this.readerName = readerName;
    }

    public String getBorrowedTime() {
        return borrowedTime;
    }

    public void setBorrowedTime(String borrowedTime) {
        this.borrowedTime = borrowedTime;
    }

    public String getReturnTime() {
        return returnTime;
    }

    public void setReturnTime(String returnTime) {
        this.returnTime = returnTime;
    }

    public String getArrears() {
        return String.format("%.2f", this.arrears);
    }

    public void setArrears(Double arrears) {
        this.arrears = arrears;
    }

    @Override
    public String toString() {
        return "BorrowInfo{" +
                "bookId=" + bookId +
                ", bookName='" + bookName + '\'' +
                ", readerId=" + readerId +
                ", readerName='" + readerName + '\'' +
                ", borrowedTime='" + borrowedTime + '\'' +
                ", returnTime='" + returnTime + '\'' +
                ", arrears='" + (arrears == null ? null : String.format("%.2f", arrears)) + '\'' +
                '}';
    }
}
